

def func():
    # l = list(map(str, input().strip().split(',')))
    l = list(map(str, input().split(',')))
    arr = list(map(int, input().split(',')))
    res = []
    l_new = []
    for i in l:
        l_new.append(list(map(int, i.split('-'))))
    l_new.sort(key=lambda x:x[0])
    for i in arr:
        for j in l_new:
            if j[1] == 0:
                continue
            if i <= j[0]:
                j[1] -= 1
                res.append('true')
                break
        else:
            res.append('false')
    print(','.join(res))
    
if __name__ == '__main__':
    func()